kanzi::DefaultLogger Class Reference

Use this class to access the Default Logger. More...

#include <kanzi/core/log/default_logger.hpp>

Static Public Member Functions

static void pushLogger (AbstractLoggerUniquePtr logger)
 Pushes a custom logger to the Default Logger object and takes the ownership of that logger. More...
 
static void pushLogger (AbstractLogger *logger)
 Pushes a custom logger to the Default Logger object and takes the ownership of that logger. More...
 
static void popLogger ()
 Removes the last pushed logger from the Default Logger object. More...
 
static void popAllLoggers ()
 Removes all custom loggers registered within the Default Logger object. More...
 
static AbstractLoggerget ()
 Gets the reference to the Default Logger object. More...
 

Detailed Description

Use this class to access the Default Logger.

The Default Logger inherits from kanzi::AbstractLogger. It is a container for an arbitrary number of other loggers.

To add a logger to the Default Logger object, use pushLogger. The implementation of the AbstractLogger::writeOverride function in the Default Logger writes log messages to all the loggers that the Default Logger contains.

To remove the last added logger from the Default Logger, use popLogger. To remove all loggers from the Default Logger, use popAllLoggers.

To get the reference to the Default Logger object, use get.

The Logging macros use the Default Logger to write log messages.

Member Function Documentation

static void kanzi::DefaultLogger::pushLogger ( AbstractLoggerUniquePtr  logger)
static

Pushes a custom logger to the Default Logger object and takes the ownership of that logger.

Use this function to append a new custom logger to be used by the Default Logger to write log messages.

Parameters
loggerNew logger to be registered within the default logger.
static void kanzi::DefaultLogger::pushLogger ( AbstractLogger logger)
inlinestatic

Pushes a custom logger to the Default Logger object and takes the ownership of that logger.

Use this function to append a new custom logger to be used by the Default Logger to write log messages.

Parameters
loggerNew logger to be registered within the default logger. You must allocate the logger dynamically with the new expression.
Deprecated:
Use the overload with AbstractLoggerUniquePtr parameter.
static void kanzi::DefaultLogger::popLogger ( )
inlinestatic

Removes the last pushed logger from the Default Logger object.

When you no longer need the logger which was last pushed to the Default Logger object, use this function to remove that logger.

static void kanzi::DefaultLogger::popAllLoggers ( )
inlinestatic

Removes all custom loggers registered within the Default Logger object.

When you call this function, all custom loggers that were pushed with pushLogger() are popped from the Default Logger object. After you call this function, the log messages written using the Default Logger object are not written anywhere.

static AbstractLogger& kanzi::DefaultLogger::get ( )
inlinestatic

Gets the reference to the Default Logger object.

Returns
Default Logger object.

The documentation for this class was generated from the following file: